<%@page contentType="text/html; charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="customer" tagdir="/WEB-INF/tags/customer"%>
<%@ taglib prefix="system" tagdir="/WEB-INF/tags/system"%>
<%@ taglib prefix="probiz" tagdir="/WEB-INF/tags/probiz"%>

<title><fmt:message key="customer.title.personalInfo"/></title>
<content tag="position">
	<fmt:message key="accountMenu.personInfo"/>&gt; <b><fmt:message key="customer.title.personalInfo"/></b>
</content>

<form name="customerForm" method="post" action="${ctxPath}/customer/csEditProfile.html?doAction=save" id="customer" onsubmit="modifyMyProfile(this);return false;">
	<div class="profile_filter">
		<p><fmt:message key="customer.personalInfoExplain1"/><br /><span class="red">*</span><fmt:message key="customer.personalInfoExplain2"/></p>
		<ins></ins>
	</div>
	<div class="tab_06">
		<ul class="content clearfix">
			<li><span><fmt:message key="customer.fillPersonalInfo"/></span></li>
		</ul>
	</div>
	<div class="display_info">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_display">
			<tr>
				<th width="15%"><fmt:message key="csCustomer.username" />：</th>
				<td><b class="red">${customer.username}</b></td>
			</tr>
			<tr>
				<th><fmt:message key="csCustomer.membership" />：</th>
				<td><span class="grade${customer.membership.membershipLevel}_s">${customer.membership.membershipName}</span></td>
			</tr>
			<tr>
				<th><fmt:message key="csCustomer.firstname" /><span class="red">*</span>：</th>
				<td>
					<spring:bind path="customer.firstname">
						<input validConf="required,maxlength=32" name="${status.expression}" class="inputtxt2" style="width:180px"
						type="text" id="${status.expression}" value="${status.value}" />
						<c:if test="${not empty status.errorMessage}">
							<span class="error_txt">${status.errorMessage}</span>
						</c:if>
					</spring:bind>
				</td>
			</tr>
			<tr>
				<th><fmt:message key="csCustomer.email" /><span class="red">*</span>：</th>
				<td>
					<spring:bind path="customer.email">
						<input validConf="required,minlength=3,maxlength=256,email" name="${status.expression}" class="inputtxt2" style="width:180px"
							type="text" id="${status.expression}" value="${status.value}" />
						<c:if test="${not empty status.errorMessage}">
							<span class="error_txt">${status.errorMessage}</span>
						</c:if>
					</spring:bind>
				</td>
			</tr>
			
			<tr>
				<th><fmt:message key="csCustomer.mobilephone" /><span class="red">*</span>：</th>
				<td>
					<spring:bind path="customer.mobilephone">
						<input validConf="required,mobile" name="${status.expression}"
							type="text" class="inputtxt2" style="width:180px"
							id="${status.expression}" value="${status.value}" />
						<c:if test="${not empty status.errorMessage}">
							<span class="error_txt">${status.errorMessage}</span>
						</c:if>
					</spring:bind>
				</td>
			</tr>
			
			<tr>
				<th><fmt:message key="csCustomer.telephone" />：</th>
				<td>
					<spring:bind path="customer.telephone">
						<input validConf="phone,maxlength=32" name="${status.expression}"
							type="text" class="inputtxt2" style="width:180px"
							id="${status.expression}" value="${status.value}" />
						<c:if test="${not empty status.errorMessage}">
							<span class="error_txt">${status.errorMessage}</span>
						</c:if>
					</spring:bind>
				</td>
			</tr>
			
			<tr>
				<th><fmt:message key="csCustomer.zip" />：</th>
				<td>
					<spring:bind path="customer.zip">
						<input validConf="maxlength=10,minlength=3" name="${status.expression}"
							type="text" class="inputtxt2" style="width:180px"
							id="${status.expression}" value="${status.value}"  />
						<c:if test="${not empty status.errorMessage}">
							<span class="error_txt">${status.errorMessage}</span>
						</c:if>
					</spring:bind>
				</td>
			</tr>
			<tr>
				<th><fmt:message key="csCustomer.fax" />：</th>
				<td>
					<spring:bind path="customer.fax">
						<input validConf="maxlength=32,minlength=0" name="${status.expression}"
							type="text" class="inputtxt2" style="width:180px"
							id="${status.expression}" value="${status.value}"  />
						<c:if test="${not empty status.errorMessage}">
							<span class="error_txt">${status.errorMessage}</span>
						</c:if>
					</spring:bind>
				</td>
			</tr>
			
			<tr>
				<th>
					<fmt:message key="csCustomer.gender" />：
				</th>
				<td>
					<customer:genderRadio  value="${customer.gender}" />
				</td>
			</tr>
		</table>
	</div>
	
	<attribute:list var="customerAttrList" type="customer" isActive="true"/>
		<c:if test="${not empty customerAttrList}">
		<div class="tab_06">
			<ul class="content clearfix">
				<li><span><fmt:message key="customer.customerAttachedInfo" /></span></li>
			</ul>
		</div>
		<div class="display_info">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_display">
				<c:forEach var="attribute" items="${customerAttrList}">
					<tr>
						<th width="15%">${attribute.attributeName }<c:if test="${attribute.isRequired==1}"><span class="red">*</span></c:if>：</th>
						<td>
							<attribute:inputStyle type="${attribute.attributeDataType}"/>
							<attribute:input cssName="${returnClassName}" cssStyle="${returnStyleName}" entity="${customer}" attribute="${attribute}" isdisplayHelp="true"  />
						</td>
					</tr>
				</c:forEach>
			</table>
		</div>
	</c:if>
	
	<div class="profile_go">
		<input name="" type="image" onclick="bCancel=false" src="${txtImagePath}/btn_submit_01.gif" alt="确定" />
	</div>
</form>

<script type="text/javascript">
$j(document).ready(function () {
	autoApplyValidate(document.getElementsByName("customerForm")[0]);
});	

function modifyMyProfile(form){
	if(validateForm(form)){
		form.submit();
	}else{
		alert(__vaMsg.notPass);
	}
}
	
</script>